import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import '../../features/home/presentation/pages/home_page.dart';
import '../../features/opacity/presentation/pages/opacity_demo.dart';
import '../../features/home/presentation/pages/device_home_page.dart';
import '../../features/infrared/presentation/pages/infrared_page.dart';

/// 应用路由配置
class AppRouter {
  /// 创建路由配置
  static final GoRouter router = GoRouter(
    initialLocation: '/',
    routes: [
      GoRoute(
        path: '/',
        name: 'home',
        builder: (context, state) => const HomePage(),
      ),
      GoRoute(
        path: '/opacity',
        name: 'opacity',
        builder: (context, state) => const OpacityDemo(),
      ),
      GoRoute(
        path: '/deviceHome',
        name: 'deviceHome',
        builder: (context, state) => const DeviceHomePage(),
      ),
      GoRoute(
        path: '/infrared',
        name: 'infrared',
        builder: (context, state) => const InfraredPage(),
      ),
      // 可以在这里添加更多路由
    ],
    errorBuilder: (context, state) => Scaffold(
      appBar: AppBar(
        title: const Text('页面未找到'),
      ),
      body: Center(
        child: Text('找不到路径: ${state.uri.path}'),
      ),
    ),
  );
}